<template>
	<view>
		<view class="">
			<!-- 2.0.19支持autoBack，默认为false -->
			<u-navbar leftText="服务项目" autoBack>
			</u-navbar>
		</view>
		<view class="con-body user-list" style="background-color: #f8f8f8;">
			<view style="padding:20rpx;">
				<image style="width:100%;" mode="widthFix" src="https://resourse.cnlhjt.com/upload/20220825/4de081bde31dfec1b4013ee27790d7ae.png"></image>
			</view>
			
			<u-empty :show="showEmpty" mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png">
			</u-empty>
			<view class="user-list-cell" v-for="(item, index) in near">
				<view class="u-flex u-row-between" style="background-color: #fff; width: 96%; margin-left: 2%;overflow: hidden;border-radius: 20rpx;">
					<image style="width:40%;height:268rpx;" :src="item.image" mode="aspectFill"></image>
					<view class="user-list" style="width:60%;height:85%;padding:20rpx 10rpx;">
						<view class="title">
							<text>{{item.name}}</text>
						</view>
						<view style="padding-bottom: 20rpx;margin-top:15rpx;">
							<view style="font-size: 24rpx;color:#666;">
								<text>看护时间:{{item.label}}</text>
							</view>
		
							<view class="d_view u-flex u-row-between" v-if="item.price == 0">
								<text style="color:red;font-size: 30rpx;">免费</text>
								<text class="btn_style" @click="join(item)">点击报名</text>
							</view>
		
							<view class="d_view u-flex u-row-between" v-else>
								<text style="color:#666;"><text style="color:red;font-size: 32rpx;">￥{{item.price}}</text>/天</text>
								<text class="btn_style" @click="join(item)">点击报名</text>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getServiceItems
	} from "@/service/shareService.js";
	export default{
		data () {
			return {
				near:[],
				showEmpty:false,
			}
		},
		onLoad() {
			getServiceItems({limit:20}).then(this.getServiceItems);
			
		},
		methods:{
			getServiceItems(e) {
				if (e.code == 200) {
					this.near = e.result;
				}
			},
			join(item) {
				if(item.nid==1){
					this.$u.route({
						url: '/pagesShare/schoole/join',
						params: {
							nid: item.id,
							memo: item.memo
						}
					})
				}else{
					this.$u.route({
						url: '/pagesShare/yanglao/join',
						params: {
							nid: item.id,
							memo: item.memo
						}
					})
				}
				
			}
		}
	}
</script>

<style lang="scss">
	page{
		background-color: #f8f8f8;
	}
	.d_title {
		font-size: 40rpx;
		color: #111111;
		margin-top: 40rpx;
		font-weight: 400;
	}
	.d_view {
		margin-top: 80rpx;
		font-size: 26rpx;
	}
	.btn_style{
		padding:5rpx 20rpx;
		border-radius: 25rpx;
		border-top-left-radius: 0;
		background-color: #ffc400;
	}
</style>
